package com.icedbrew.appfuel.application;

import com.icedbrew.appfuel.IDatabaseUpdate;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

import javax.swing.border.EmptyBorder;
import java.util.Set;

/**
 * Skeleton base application class.
 * Unless you want to roll out a different application implementation,
 * you are encouraged to extend this class as much as possible.
 * @author
 */
public abstract class AppFuelApplication extends WebApplication {

	@Autowired
	private ApplicationContext context;

	@Override
	protected void init() {
		super.init();
		getComponentInstantiationListeners().add(new SpringComponentInjector
				(this, context, wrapSpringBeansInProxies()));
	}

	/**
	 * Should the spring beans be wrapped in proxies.
	 */
	protected abstract boolean wrapSpringBeansInProxies();

	protected Set<IDatabaseUpdate> getDatabaseUpdates() {
		return null;    //returns null by default
	}
}
